import { defineStore } from 'pinia';
import { useProductApi } from '/@/api/product';
const { getCateList } = useProductApi();

export const useOptions = defineStore('options', {
	state: () => ({
		cateList: [],
		positionList: [],
	}),
	actions: {
		setCateList(cateList) {
			this.cateList = cateList;
		},
		setPositionList(positionList) {
			this.positionList = positionList;
		},
		async setCateListAsync() {
			let res = await getCateList(-1, 1);
			if (res.code !== 200) return;
			this.cateList = res.data;
		},
	},
});
